<script setup lang="ts">
import ApplyCO from '@/components/ApplyCo.vue';
import ApplySend from '@/components/ApplySend.vue';
import router from '@/router';
import { onMounted } from 'vue';
import { ref } from 'vue';
import { useRoute } from 'vue-router';

const route = useRoute()
const docidtemp = ref('')
const isMounted = ref(false)

onMounted(()=>{
   docidtemp.value = route.query.docidtmep ? route.query.docidtmep.toString() : ""
   isMounted.value = true
})

function returnApply(){
   docidtemp.value = ""
   router.replace({path:"/materialSub/apply",query:{docid:""}})
}

</script>

<template>
  <main>
     <div class="apply_box_apply">
        <ApplyCO v-if="!docidtemp"></ApplyCO>
        <ApplySend :docid="docidtemp" :isMounted="isMounted" @returnApply="returnApply"></ApplySend>
     </div>
  </main>
</template>

<style>
 .apply_box_apply{
  width: 90%;
  margin: 30px auto;
  min-height: 610px;
  min-width: 850px;
  max-width: 900px;
  border-radius: 20px;
  background-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0px 10px 10px 0px rgba(30, 30, 30, 0.7);
 }
</style>